package com.base.demo.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * ClassName: Hello
 * PackageName: com.cwy.demo.controller
 * Describe:
 *
 * @author: Cheng Wenying
 * @Create: 2023/12/5
 * @version:
 */
@RestController
public class Hello {
    @Autowired
    private Environment environment;
//    @Value("${name}")
//    private String name;

    @GetMapping("/getName")
    public String getName() {
        System.out.println(environment.getProperty("name"));
        return environment.getProperty("name");
    }
}
